package cn.com.duiba.millionaire.center.biz.dao;

import cn.com.duiba.millionaire.center.biz.bo.ConsumeAccountInfoParam;
import cn.com.duiba.millionaire.center.biz.bo.ConsumerRenascenceInfoParam;
import cn.com.duiba.millionaire.center.biz.bo.UserReLiveCardParam;
import cn.com.duiba.millionaire.center.biz.entity.MillionaireConsumerEntity;

import java.util.List;

/**
 * Created by zzy on 2018/1/17.
 */
public interface MillionaireConsumerDao {
    MillionaireConsumerEntity insert(MillionaireConsumerEntity entity);

    int batchInsert(List<MillionaireConsumerEntity> entitys, String sufix);

    MillionaireConsumerEntity findByConsumerId(Long consumerId);

    int updateShareCode(Long consumerId, String shareCode);

    /**
     * 传入的复活卡数量为新增的数量
     *
     * @param consumerId
     * @param renascenceNum
     * @return
     */
    int updateRenascenceNum(Long consumerId, Integer renascenceNum);


    /**
     * 根据某一表，批量在该表查询
     * @param consumerIds
     * @return
     */
    List<MillionaireConsumerEntity> batchFindConsumer(List<Long> consumerIds, String sufix);

    /**
     * 批量扣除用户的复活卡
     * @param cidAndNums
     * @param sufix
     * @return
     */
    int batchResumeConsumerRenascence(List<ConsumerRenascenceInfoParam> cidAndNums, String sufix);

    /**
     * 批量扣除用户的复活卡
     * @param cidAndNums
     * @param sufix
     * @return
     */
    int batchAddConsumerAccount(List<ConsumeAccountInfoParam> cidAndNums, String sufix);

    /**
     * 锁定查询
     * @param consumerId
     * @return
     */
    MillionaireConsumerEntity select4Update(long consumerId);

    /**
     * 提现扣款
     * @param consumerId
     * @param changeAmount
     * @return
     */
    boolean withdrawCash(long consumerId, int changeAmount);

    /**
     * 提现失败返还
     * @param consumerId
     * @param changeAmount
     * @return
     */
    boolean withdrawCashPayback(long consumerId, int changeAmount);


    /**
     * 批量增加复活卡
     * @param param
     * @param sufix
     * @return
     */
    int batchUpdateRenascenceNum(List<UserReLiveCardParam> param, String sufix);
}
